From: Andrew Cooper Date: Thu, 11 Feb 2021 14:22:44 +0000 (+0000) Subject: tools: Use -Og for debug builds when available X-Git-Tag: archive/raspbian/4.16.0+51-g0941d6cb-1+rpi1~2^2~42^2~884 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/success/%22http:/www.example.com/cgi/success?a=commitdiff_plain;h=4abb20e321626c3d3cb0e922eac2048dc15d7c87;p=xen.git tools: Use -Og for debug builds when available The recommended optimisation level for debugging is -Og, and is what tools such as gdb prefer. In practice, it equates to -01 with a few specific optimisations turned off. abi-dumper in particular wants the libraries it inspects in this form. Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich Acked-by: Ian Jackson Release-Acked-by: Ian Jackson --- diff --git a/tools/Rules.mk b/tools/Rules.mk index f61da81f4a..2907ed2d39 100644 --- a/tools/Rules.mk +++ b/tools/Rules.mk @@ -106,8 +106,9 @@ endif CFLAGS_libxenlight += $(CFLAGS_libxenctrl) ifeq ($(debug),y) -# Disable optimizations -CFLAGS += -O0 -fno-omit-frame-pointer +# Use -Og if available, -O0 otherwise +dbg_opt_level := $(call cc-option,$(CC),-Og,-O0) +CFLAGS += $(dbg_opt_level) -fno-omit-frame-pointer # But allow an override to -O0 in case Python enforces -D_FORTIFY_SOURCE=. PY_CFLAGS += $(PY_NOOPT_CFLAGS) else